package com.magic.rabbit.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author laoma
 * @create 2021-04-13 0:12
 */
@Configuration
public class DirectConfig {
    @Bean
    Queue directQueue(){
        return new Queue("javaboy-queue");
    }

    @Bean
    DirectExchange directExchange(){
        return new DirectExchange("javaboy-direct",true,false);
    }

    @Bean
    Binding directBinding(){
        return BindingBuilder.bind(directQueue()).to(directExchange()).with("direct");
    }
}
